package cn.itcast.web.servlet;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Properties;

public class Druid连接池 {
    public static void main(String[] args) throws Exception{
        Properties properties = new Properties();
        properties.load(Druid连接池.class.getClassLoader().getResourceAsStream("druid.properties"));

        DataSource dataSource = DruidDataSourceFactory.createDataSource(properties);

        System.out.println(dataSource.getConnection());
        System.out.println(dataSource.getConnection());
        System.out.println(dataSource.getConnection());
        System.out.println(dataSource.getConnection());
        System.out.println(dataSource.getConnection());
    }
}
